<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import { useCounterStore } from "./store/counter";
const counter=useCounterStore()
interface systemType{
	statusBarHeight:number
}
onLaunch(() => {
	
  uni.getStorage({
	  key:'userinfo',
	  success: async(res) => {
	  	console.log('获取本地账户信息',res);
		counter.userData=await res.data
		 handleNavigation()
		 counter.cllectedW(counter.userData!.objectId)
	  },
	  fail: (err) => {
	  	console.log(12345566);
		uni.navigateTo({
			url:'/pages/mine/login'
		})
	  }
  })

});
// 提取导航逻辑为单独函数
const handleNavigation = () => {
  if (counter.userData?.islogin) {
    uni.switchTab({
      url: '/pages/home/home'
    })
  } else {
    uni.navigateTo({
      url: '/pages/mine/login'
    })
  }
}
onShow(() => {
  console.log("App Show");
});
onHide(() => {
  console.log("App Hide");
});
</script>
<style>
@import'colorui/icon.css';
@import'colorui/main.css';
@import'colorui/animation.css';
@import'static/font/iconfont.css'
</style>
